package com.atwisdom.star.exception.pojo;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ResultEx<T>  {
    /**
     * 响应码
     */
    private String code;

    private boolean success;

    private String message;

    private T data;


    public static <T> ResultEx<T> ex(ErrorEnum errorEnum) {
        ResultEx<T> res = new ResultEx<T>();
        res.setSuccess(false);
        res.setCode(errorEnum.getCode());
        res.setMessage(errorEnum.getMsg());
        return res;
    }

    public static <T> ResultEx<T> ex(String code,String message) {
        ResultEx<T> res = new ResultEx<T>();
        res.setSuccess(false);
        res.setCode(code);
        res.setMessage(message);
        return res;
    }
}
